home *** CD-ROM | disk | FTP | other *** search
- From: magicsn@birdland.es.bawue.de (Steffen Haeuser)
- Path: eisbaer.bb.bawue.de!birdland.es.bawue.de
- Newsgroups: comp.sys.amiga.programmer
- Message-ID: <00000405732623060000@BIRDLAND>
- X-Mailer: fastnet2rfc V2.0 - (tse) Lunqual%MAB@wsb.freinet.de / Tachy@wsb.freinet.de
- Organization: Birdland BBS, Dettingen/Teck, South Germany, +49-7021-862428
- Content-Type: text/plain; charset=ISO-8859-1
- Subject: rtgmaster c2p complete rework :)
- Date: 01 Mar 1996 23:31:46
-
- Sorry, that the docs i sent were a bit ... buggy... i now reworked
- the whole thing completely... but still "Beta, to be commented
- from people who know about what they are talking (c2p authors...)"
- If it changes, the final version will be somewhen available together
- with rtgmaster.library...
-
- The RtgMaster c2p Standard V 1.0
- ================================
-
- 1. What is it/What is rtgmaster ?
- 2. The Structure of a RtgMaster c2p File
- 3. The Functions and its specification
- 4. The specification of the data
- 5. How will this be used in an application ?
- 6. Error Handling
- 7. Includes
- 8. A word from the Authors
-
- ---------------------------------------------------------------------------
-
- 1. What is it/What is rtgmaster ?
- =================================
-
- rtgmaster.library is a soon to be released ASM written Library for
- Graphicsboard AND ECS/AGA compatibility in games and demos. It is
- NOT a WB Emulation, but contrary to some WB Emulations it is done
- in a way that make that things, that demo/game coders need, EASY
- TO DO.
-
- Among its features, rtgmaster.library (a Beta version is available
- from me, MagicSN@birdland.es.bawue.de), supports a standard for
- c2p functions. This will used with the rtgmaster call CallRtgC2P.
- CallRtgC2P performs a simple "CopyPixelArray" style function for
- Graphics Boards (but does not use the OS, instead it directly
- accesses the Video Memory, using longword access where possible),
- and performs c2p for ECS/AGA. The c2p is choosable from a file
- and the c2p function will be loaded during opening the screen.
- This file describes how you can change your c2p algorithm so that
- it is usable with rtgmaster.library (you can choose the c2p using
- the Screenmode Requester of rtgmaster.library).
-
- I want to note, that anybody who has converted his c2p functions
- to the rtgmaster standard, should send them to me, so that they
- can be included to the rtgmaster package as soon as it is
- released.
-
- And, by the way... forget about that earlier "rtgmaster c2p standard"
- document... that was only a first try :) (Bad documentation,
- bad functionality, bad structure...) This here is the real thing.
-
- ----------------------------------------------------------------------------
-
- 2. The Structure of a Rtgmaster c2p File
- ========================================
-
- Primarily this is a file that will be loaded to the memory using dos.library
- call LoadSeg(). After being loaded in, it looks somewhat like :
-
- moveq #0,d0
- rts
- .s dc.l "c2p!"
- dc.l .s
- dc.l 1 ; Versionnumber
- dc.l Structure ; Pointer to your data structure
-
- Structure is of Type c2p_Info.
-
- STRUCTURE c2p_Info,0
- WORD CI_ColorDepth ;CI_256, CI_128, CI_64, CI_EHB, CI_32..
- WORD CI_CPU ;CI_68060, CI_68040, CI_68030....
- WORD CI_Needs ;CI_Aikiko, CI_MMU, CI_FPU...
- UBYTE CI_PixelSize ;CI_1x1, CI_1x2, CI_2x1, CI_2x2...
- BOOL CI_Dirty ;TRUE/FALSE
- BOOL CI_Hack ;TRUE/FALSE
- BOOL CI_Asynchrone ;TRUE/FALSE
- WORD CI_WidthAlign ;Width has to be divisible by <number>
- WORD CI_HeightAlign ;Height has to be divisible by <number>
- WORD CI_Misc ;Different stuff...
- ULONG CI_AmiCompatible ;Is this compatible to RtgScreenAMI ?
- APTR CI_Description ;Pointer to a string
- APTR CI_Initialization ;Pointer to Initialization code
- APTR CI_Expunge ;Pointer to Expunge code
- APTR CI_Normal_c2p ;Pointer to c2p code
- APTR CI_Normal_c2p_InterL ;Pointer to Interleaved c2p
- APTR CI_Scrambled_c2p ;Pointer to Scrambled c2p
- APTR CI_Scrambled_c2p_InterL ;Pointer to Scrambled Interleaved c2p
- LABEL CI_SIZEOF
-
-
- In the following chapters, it will be discussed how all those entries look
- like, how they will be used by rtgmaster.library, how they have to be coded,
- what error messages have to supported and related issues.
-
- ----------------------------------------------------------------------------
-
- 3. The functions and its specification
- ======================================
-
- To support rtgmaster c2p, you will need some or more of the functions :
-
- * CI_Initialization
- * CI_Expunge
- * CI_Normal_c2p
- * CI_Normal_c2p_InterL
- * CI_Scrambled_c2p
- * CI_Scrambled_c2p_InterL
-
- CI_Initialization
- -----------------
-
- Some c2p algorithms need an initialization part, to allocate extra Buffers,
- to calculate initialization conditions and similar things. This will be the
- place where to do this.
-
- You will get a parameter in a0, when this function is called. This parameter
- is a pointer to the RtgScreenAMI structure of the Screen, to which the c2p algorithm is
- to attach. There can only be one c2p algorithm installed in a system, but
- it can be changed as soon as a Screenmode-Requester of rtgmaster.library
- is opened (But the c2p of an already running program won't change).
-
- The CI_Initialization code will be called from the OpenRtgScreen function
- of rtgAMI.library, the rtgmaster sublibrary for ECS/AGA.
-
- This c2p format only supports Planar rtgmaster Sublibraries whose RtgScreen
- structure is compatible to RtgScreenAMI, but anyways, there do not exist
- Planar sublibraries for other hardware. Coders of guessed future Planar
- Graphics Sublibraries should be sure, that at least the entries
-
- * rsAMI_ScreenHandle
- * rsAMI_PlaneSize
- * rsAMI_Bitmap1
-
- will be at the same place for their sublibraries, if they want to use
- existing c2p code. If that is not possible, they should check in their
- sublibrary's CallRtgC2P code for CI_AmiCompatible (more information in
- the chapter about the Rtgmaster c2p data structures).
-
- You might save any stuff that is allocated during the initialization part
- in rs_c2pcode(a0), where a0 is the before mentioned pointer to the given
- RtgScreenAMI structure.
-
- If your c2p code does not need any initialization, simply give 0 as the
- pointer to the initialization code.
-
- Parameters :
-
- a0.l = Pointer to RtgScreenAMI
-
- Output :
-
- d0.l = 0, if failed, else 1
-
- CI_Expunge
- ----------
-
- This function returns any system resources and memory to where they belong.
- It is called during CloseRtgScreen of rtgAMI.library. You will get a pointer
- to the RtgScreenAMI structure of the Screen, to which the c2p was attached,
- in a0.
-
- Parameters :
-
- a0.l = Pointer to RtgScreenAMI
-
- Output :
-
- d0.l = 0, if failed, else 1
-
- CI_Normal_c2p
- -------------
-
- This is the c2p main function for non-interleaved screens with contintiguous
- Bitmaps. As this c2p code supports rtgmaster.library, it might use up to three
- buffers, but that might not bother you, you will already get the correct
- Bitplane 0 Base addresses by CallRtgC2P.
-
- CI_Normal_c2p_InterL works much the same way, only that it is intended for
- interleaved Screens. It is possible to include functions for all four types
- of c2p functions to one c2p file. CallRtgC2P will call the correct one.
-
- Parameters :
-
- a0.l = Pointer to the Chunky Data
- a1.l = Pointer to Bitplane 0
- a2.l = Pointer to a Byte containing the "Dirty" Flag (see below)
- a3.l = Pointer to the RtgScreenAMI structure, to which the c2p should be attached
- a4.l = Pointer to a Rectangle, like defined in include:graphics/gfx.i, which
- specifies, which region of the display the c2p should handle, or 0, if
- fullscreen c2p was intended.
- d0.l = c2p Modus (see below)
- d1.l = Planesize : (width*height)/8
- d2.l = An exec signal, for asynchrone c2p
-
- Now, what should such a function do ? At first it should do error-handling,
- like described in a later chapter, after that it should perform c2p, and as
- soon as it is finished it should signal the waiting task, that it is finished.
- This way, you are able to implement asynchrone c2p. Even synchrone c2p algorithms
- have to signal the task, else it waits forever.
-
- Output :
-
- d0.l = 0, if everything worked, else error-code (see below)
-
- CI_Scrambled_c2p
- ----------------
-
- This is the c2p main function for non-interleaved screens with Bitmaps, that
- use "scrambled" c2p. These are algorithms, where the bitplanes are not in the
- normally assumed order. They should still be contiguous, though. To set a standard,
- I have to admit, i do not know much about scrambled c2p, only that Gloom Deluxe
- uses it, and therefor it is specified, that rtgmaster scrambled c2p has to use
- the same Bitplane order as this is done for Gloom Deluxe c2p. For more information
- about Gloom Deluxe c2p, get GloomC2P10.lha from Aminet.
-
- It is strongly discouraged to write scrambled-only c2p, as then the coder using
- the c2p can't use the same chunky buffer for Graphics Boards and AGA, as CallRtgC2P
- does a fast "Write from Fastram-Buffer to Video-RAM" instead of c2p-ing. The user
- will be told, that this c2p won't work with all programs, if he chooses a scrambled
- chunky c2p, and he will be asked, if he wants to select the Scrambled or the Non-scrambled
- code, if both are available for a Rtgmaster c2p File. Scrambled c2p sometimes might
- be faster than non-scrambled c2p.
-
- The Parameters and output are the same as for non-scrambled c2p, and there, too, exist
- too types of c2p, for non-interleaved and for interleaved Bitmaps.
-
- ----------------------------------------------------------------------------------------------
-
- 4. The specification of the data
- ================================
-
- STRUCTURE c2p_Info,0
- WORD CI_ColorDepth ;CI_256, CI_128, CI_64, CI_EHB, CI_32..
- WORD CI_CPU ;CI_68060, CI_68040, CI_68030....
- WORD CI_Needs ;CI_Aikiko, CI_MMU, CI_FPU...
- UBYTE CI_PixelSize ;CI_1x1, CI_1x2, CI_2x1, CI_2x2...
- BOOL CI_Dirty ;TRUE/FALSE
- BOOL CI_Hack ;TRUE/FALSE
- BOOL CI_Asynchrone ;TRUE/FALSE
- WORD CI_WidthAlign ;Width has to be divisible by <number>
- WORD CI_HeightAlign ;Height has to be divisible by <number>
- WORD CI_Misc ;Different stuff...
- ULONG CI_AmiCompatible ;Is this compatible to RtgScreenAMI ?
- APTR CI_Description ;Pointer to a string
- APTR CI_Initialization ;Pointer to Initialization code
- APTR CI_Expunge ;Pointer to Expunge code
- APTR CI_Normal_c2p ;Pointer to c2p code
- APTR CI_Normal_c2p_InterL ;Pointer to Interleaved c2p
- APTR CI_Scrambled_c2p ;Pointer to Scrambled c2p
- APTR CI_Scrambled_c2p_InterL ;Pointer to Scrambled Interleaved c2p
- LABEL CI_SIZEOF
-
- * CI_Colordepth : Contains the Colordepths supported by this c2p algorithm.
-
- CI_256 : AGA 256 colors
- CI_128 : AGA 128 colors
- CI_64 : AGA 64 colors
- CI_EHB : ECS 64 colors (EHB)
- CI_32 : ECS 32 colors
- CI_16 : ECS 16 colors
- CI_8 : ECS 8 colors
- CI_4 : ECS 4 colors
- CI_2 : ECS 2 colors
-
- There might be more available bits, if future Amigas support more Planar
- modes. Therefor i choose a WORD for this structure.
-
- If a c2p is run and a screen with the wrong colour depth is opened, the
- c2p operation fails. (see below)
-
- * CI_CPU : Contains information about the supported CPU.
-
- CI_68060 : Runs on 68060.
- CI_68040 : Runs on 68040.
- CI_68030 : Runs on 68030.
- CI_68020 : Runs on 68020.
-
- These bits are set, if it runs, cleared, if not. As rtgmaster.library
- needs 68020 at least, no Bits for 68000/68010.
-
- CI_68060D : Don't know, if it runs on 68060.
- CI_68040D : Don't know, if it runs on 68040.
- CI_68030D : Don't know, if it runs on 68030.
- CI_68020D : Don't know, if it runs on 68020.
-
- This might be expanded in the future, as soon as Power PC Amigas
- with 680x0 emulations will appear.
-
- * CI_Needs : Some c2p needs special hardware to run.
-
- CI_68060N : 68060 only code.
- CI_68040N : Needs 68040 at least.
- CI_68030N : Needs 68030 at least.
- CI_Aikiko : Needs Aikiko.
- CI_MMU : Needs an MMU.
- CI_FPU : Needs an FPU.
-
- This might be expanded in the future.
-
- Notice, that the hardware won't be checked for the correct cpu, but
- the information will be given to the user. Maybe it will be checked
- when the user selects the c2p for his system in a future version of
- rtgmaster.library. (see below)
-
- * CI_PixelSize : Which Pixelsizes are supported by the c2p.
-
- c2p_1x1
- c2p_1x2
- c2p_2x1
- c2p_2x2
- c2p_2x4
- c2p_4x2
- c2p_4x4
-
- are the types for which the "Dirty" Flag will be ignored. The Dirty
- Flag specifies (if set), that not all CI_WidthAlign Pixels have to be
- processed, if not needed.
-
- c2p_1x1D
- c2p_1x2D
- c2p_2x1D
- c2p_2x2D
- c2p_2x4D
- c2p_4x2D
- c2p_4x4D
-
- are the types that try to use the "Dirty" Flag. It could still be set to
- 0, though.
-
- c2p_Best and c2p_BestD try to use the highest resolution mode.
- c2p_Fastest and c2p_FastestD try to use the fastest ones.
- c2p_Selected and c2p_SelectedD try to use the one selected by the user
- as standard c2p.
-
- You will have to check yourselves, if the ordered mode is existing in
- this c2p (see below).
-
- * CI_Dirty : Specifies if this c2p supports a dirty flag. It can be
- true (1) or false (0).
-
- * CI_Hack : Specifies, if this c2p uses some ugly hardware hacks, that
- might not run on Intuition Screens. It then only will be used with
- a still not existing hardware-banging RtgScreenAMI compatible
- rtgmaster sublibrary. Only specify this, if it REALLY does not run
- with Intuition Screens. Planar sublibraries that are for hardware
- other than ECS/AGA, will fail, if trying to use such c2p code.
- Can be true (1) or false (0).
-
- * CI_Asynchrone : Specifies, if the c2p code is asynchrone (1) or
- synchrone (0).
-
- * CI_WidthAlign : Specifies, if the c2p code needs a screen whose width
- is divisible by a certain number. This value contains this number, or
- 0, if this is not needed.
-
- * CI_HeightAlign : The same for the height.
-
- * CI_Misc :
-
- CI_Smaller : If this bit is set, the c2p algorithm supports c2p-ing
- rectangles that are smaller than Full-Screen.
-
- CI_Misc might be expanded in the future.
-
- * CI_AmiCompatible : Contains 'AMI ', if this c2p code is compatible
- with RtgScreenAMI. If not, it contains the code of the sublibrary
- with that it is compatible (three letters + blank or four letters).
-
- * CI_Description : Points to a string discribing this c2p algorithm.
- Up to 255 letters, 0-terminated.
-
- ----------------------------------------------------------------------------------------------
-
- 5. How will this be used in an application ?
- ============================================
-
- Normally this c2p will be called using rtgmaster.library function CallRtgC2P.
- I am including the Autodocs for CallRtgC2P at the end of this chapter. People
- who are interested in rtgmaster.library, should mail me at MagicSN@birdland.es.bawue.de
-
- The c2p code is integrated the following way :
-
- 1. The user selects a c2p code to be used for his systemusing the rtgmaster
- Screenmode Requester. The Path of this file will be stored in envarc:rtgmaster/c2p.
- Then he chooses a default mode, that will be stored in envarc:rtgmaster/c2pcurr. (=> Next mail)
-